package com.itheima.Demo01.demo03;

import java.io.*;
import java.net.Socket;
import java.util.Date;

public class ServerSockeT {
    public static void main(String[] args) throws IOException {
        java.net.ServerSocket SS = new java.net.ServerSocket(10010);
        Socket accept = SS.accept();
        BufferedInputStream bis =new BufferedInputStream(accept.getInputStream());
        BufferedOutputStream bos = new BufferedOutputStream(
                new FileOutputStream("day0702-code\\AA"+new Date().getTime() +".jpg"));
          byte[]arr = new byte[1024*8];
          int len;
          while ((len=bis.read(arr))!=-1){
              bos.write(arr,0,len);
              bos.flush();
          }
          bos.close();
          PrintWriter P =new PrintWriter(accept.getOutputStream(),true);
          P.println("上传成功");
          P.close();
          SS.close();
    }
}
